#!/bin/bash

###############################################
###### IRIS-Processor #########################
###############################################

# This script processes an iris-database the following way
# Input Image 	=> Segmentation result (<filename>.png)
#		=> Iris code	       (<filename>.png)


if [ $# -ne 3 ]; then
	echo 'Call with parameters <SEGMENTATIONTOOL> <DATAROOT> <TARGET>';
	echo '<SEGMENTATIONTOOL> ... wahet or caht <DATAROOT> <TARGET>';
	echo '<DATAROOT> ... e.g. databases_compressed/iitd';
	echo '<TARGET> ... e.g. results/iitd';
	exit;
fi
 
 



TOOL=$1
TARGET=$3
DATAROOT=$2

echo 'segmentation of ' $DATAROOT ' with ' $TOOL to $TARGET

rm -rf $TARGET;
mkdir -p $TARGET;


# cd $DATAROOT;
# Find methods
METHODS=`ls -d $DATAROOT/method_*/`


for method in $METHODS
do

  m=${method/$DATAROOT\//}
  echo $m

  
  echo "Eval method $m"

  mkdir -p $TARGET/$m
  
  
  # For each method there's a folder single and double
  
   # Work the singles before
  ./irisSegmentation.sh $TOOL $method/single/ $TARGET/$m/single/
  
  
  # for the doubles, there are several different qualities first:
   ./irisSegmentation.sh $TOOL $method/double/ $TARGET/$m/double/
  
  
  
 
  
  
  
  

done
